package com.youyun56.gps.android.events;

import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemSelectedListener;
import android.widget.TextView;

import com.youyun56.gps.android.GoodInfoActivity;
import com.youyun56.gps.android.R;

public class GoodInfoItemSelectedListener implements OnItemSelectedListener {
    private View lastView;
    private GoodInfoActivity activity;

    public GoodInfoItemSelectedListener(GoodInfoActivity activity) {
        // TODO Auto-generated constructor stub
        this.activity = activity;
    }

    @Override
    public void onItemSelected(AdapterView<?> listView, View view, int index, long lineId) {
        if (view != activity.getFooterView()) {
            if (lastView != null) {
                TextView contact = (TextView) lastView.findViewById(R.id.contact);
                contact.setVisibility(View.GONE);
            }
            TextView contact = (TextView) view.findViewById(R.id.contact);
            contact.setVisibility(View.VISIBLE);
            lastView = view;
        }
    }

    @Override
    public void onNothingSelected(AdapterView<?> arg0) {
        // TODO Auto-generated method stub

    }

}
